#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>


int main()
{
    int n = 0;
    int m = 0;
    int max = 0;
    int min = 100;
    scanf("%d", &n);

    int i = 0;
    while (i < n)
    {
        scanf("%d", &m);
        if (m > max)
        {
            max = m;
        }
        if (m < min)
        {
            min = m;
        }
        i++;
    }

    printf("%d", max - min);
    return 0;
}